/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.mobiubiq.directory.client.object;

import com.google.zxing.Result;

/**
 *
 * @author Marnix Renne
 */
public class BarcodeObject extends AbstractObject {
    private Result result;
    private java.lang.String barcode;
    
    public BarcodeObject() {
        super("", ObjectType.BARCODE);
    }
    public BarcodeObject(Result result) {
        super(result.getText(), ObjectType.BARCODE);
        this.result = result;
        barcode = result.getText();
    }
    
    public String getBarcode() {
        return barcode;
    }
    
    public void setBarcode(String value) {
        barcode = value;
    }

    public int hashCode() {
        int hash = 5;
        hash = 47 * hash + (this.barcode != null ? this.barcode.hashCode() : 0);
        return hash;
    }
    
    public boolean equals(Object o) {
        if(this == o) {
            return true;
        }
        if(o instanceof BarcodeObject) {
            BarcodeObject other = (BarcodeObject) o;
            if(getType() == other.getType()) {
                if (barcode.equals(other.getBarcode())) {
                    return true;
                }
            }
        }
        return false;
    }
}
